/*
 * @Description: 
 * @Author: Yong
 * @Date: 2021-10-04 13:39:16
 * @LastEditTime: 2021-10-04 14:41:52
 */
const path = require('path')
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin') // 压缩css
module.exports = {
    splitChunks: {
        chunks: "all",
        cacheGroups: {
            vendors: {
                test: /node_modules/,
                name: 'vendors',
                minSize: 0,
                minChunks: 1,
                chunks: 'initial',
                priority: 2 // 该配置项是设置处理的优先级，数值越大越优先处理 
            },
            commons: {
                name: "comomns",
                test: path.join(__dirname, './../', 'src'), // 可自定义拓展规则
                minChunks: 2, // 最小共用次数
                minSize: 0,   //代码最小多大，进行抽离
                priority: 1, //该配置项是设置处理的优先级，数值越大越优先处理 
            }
        }
    },
    // 压缩css
    minimize: true,
    minimizer: [new OptimizeCssAssetsPlugin({})]
}